
package client.status;



import client.MapleCharacter;
import server.Timer;
import server.life.MapleMonster;
import server.life.MobSkill;

import java.lang.ref.WeakReference;
import java.util.concurrent.ScheduledFuture;









 public class MonsterStatusEffect
         {
       private final int skill;
       private final MobSkill mobskill;
       private final boolean monsterSkill;
       private MonsterStatus stati;
    /*  17 */   private WeakReference<MapleCharacter> weakChr = null;
       private Integer x;
    /*  19 */   private int poisonSchedule = 0;
    /*  20 */   private int moboid = 0;
       private boolean reflect = false;
    /*  22 */   private long cancelTime = 0L;
    private long dotTime = 0L;
    /*  23 */   private int DOTStack = 0;
    /*  24 */   private long startTime = System.currentTimeMillis();
       private boolean firstUse = true;
    /*  26 */   private int angle = 0;
    /*  27 */   private int count = 1;
       private boolean cannotCancel = false;
       private boolean cannelPoison = true;
       private ScheduledFuture doPoisonSchedu;



    public MonsterStatusEffect(MonsterStatus stat, Integer x, int skillId, MobSkill mobskill, boolean monsterSkill) {
        /*  33 */
        this.stati = stat;
        /*  34 */
        this.x = x;
        /*  35 */
        this.skill = skillId;
        /*  36 */
        this.mobskill = mobskill;
        /*  37 */
        this.monsterSkill = monsterSkill;

    }



    public MonsterStatusEffect(MonsterStatus stat, Integer x, int skillId, MobSkill mobskill, boolean monsterSkill, int stack) {
        /*  41 */
        this.stati = stat;
        /*  42 */
        this.x = x;
        /*  43 */
        this.skill = skillId;
        /*  44 */
        this.mobskill = mobskill;
        /*  45 */
        this.monsterSkill = monsterSkill;
        /*  46 */
        this.DOTStack = stack;

    }



    public MonsterStatusEffect(MonsterStatus stat, Integer x, int skillId, MobSkill mobskill, boolean monsterSkill, boolean reflect) {
        /*  50 */
        this.stati = stat;
        /*  51 */
        this.x = x;
        /*  52 */
        this.skill = skillId;
        /*  53 */
        this.mobskill = mobskill;
        /*  54 */
        this.monsterSkill = monsterSkill;
        /*  55 */
        this.reflect = reflect;
        /*  56 */
        this.DOTStack = 0;

    }



    public MonsterStatusEffect(MonsterStatus stat, Integer x, int skillId, MobSkill mobskill, boolean monsterSkill, boolean reflect, int Stack) {
        /*  60 */
        this.stati = stat;
        /*  61 */
        this.x = x;
        /*  62 */
        this.skill = skillId;
        /*  63 */
        this.mobskill = mobskill;
        /*  64 */
        this.monsterSkill = monsterSkill;
        /*  65 */
        this.reflect = reflect;
        /*  66 */
        this.DOTStack = Stack;

    }



    public MonsterStatus getStati() {
        /*  70 */
        return this.stati;

    }



    public Integer getX() {
        /*  74 */
        return Integer.valueOf(this.x.intValue() * this.count);

    }



    public void setValue(MonsterStatus status, Integer newVal) {
        /*  78 */
        this.stati = status;
        /*  79 */
        this.x = newVal;

    }



    public int getSkill() {
        /*  83 */
        return this.skill;

    }



    public MobSkill getMobSkill() {
        /*  87 */
        return this.mobskill;

    }



    public boolean isMonsterSkill() {
        /*  91 */
        return this.monsterSkill;

    }






    public long getCancelTask() {
        /*  98 */
        return this.cancelTime;

    }






    public void setCancelTask(long cancelTask) {
        /* 105 */
        this.cancelTime = System.currentTimeMillis() + cancelTask;

    }



    public long getDotTime() {
        /* 109 */
        return this.dotTime;

    }



    public void setDotTime(long duration) {
        /* 113 */
        this.dotTime = duration;

    }



    public void setPoisonSchedule(int poisonSchedule, MapleCharacter chrr) {
        /* 117 */
        this.poisonSchedule = poisonSchedule;
        /* 118 */
        this.weakChr = new WeakReference<>(chrr);

    }



    public int getPoisonSchedule() {
        /* 122 */
        return this.poisonSchedule;

    }



    public boolean shouldCancel(long now) {
        /* 126 */
        return (this.cancelTime > 0L && this.cancelTime <= now);

    }



    public void cancelTask() {
        /* 130 */
        this.cancelTime = 0L;

    }



    public boolean isReflect() {
        /* 134 */
        return this.reflect;

    }



    public int getFromID() {
        /* 138 */
        return (this.weakChr == null || this.weakChr.get() == null) ? 0 : ((MapleCharacter) this.weakChr.get()).getId();

    }



    public WeakReference<MapleCharacter> getWeakChr() {
        /* 142 */
        return this.weakChr;

    }



    public void cancelPoisonSchedule(MapleMonster mm) {
        /* 146 */
        mm.doPoison(this, this.weakChr);
        /* 147 */
        setCannelPoison(true);
        /* 148 */
        this.poisonSchedule = 0;
        /* 149 */
        this.weakChr = null;

    }



    public int GetStack() {
        /* 153 */
        return this.DOTStack;

    }



    public long getStartTime() {
        /* 157 */
        return this.startTime;

    }



    public void setStartTime(long startTime) {
        /* 161 */
        this.startTime = startTime;

    }



    public boolean isFirstUse() {
        /* 165 */
        return this.firstUse;

    }



    public void setFirstUse(boolean firstUse) {
        /* 169 */
        this.firstUse = firstUse;

    }



    public int getAngle() {
        /* 173 */
        return this.angle;

    }



    public void setAngle(int angle) {
        /* 177 */
        this.angle = angle;

    }



    public int getCount() {
        /* 181 */
        return this.count;

    }



    public void setCount(int count, boolean gain) {
        /* 185 */
        this.count = gain ? count : (this.count += count);

    }



    public int getMoboid() {
        /* 189 */
        return this.moboid;

    }



    public void setMoboid(int moboid) {
        /* 193 */
        this.moboid = moboid;

    }



    public boolean isCannotCancel() {
        /* 197 */
        return this.cannotCancel;

    }



    public void setCannotCancel(boolean cannotCancel) {
        /* 201 */
        this.cannotCancel = cannotCancel;

    }



    public boolean isCannelPoison() {
        /* 205 */
        return this.cannelPoison;

    }



    public void setCannelPoison(boolean cannelPoison) {
        /* 209 */
        this.cannelPoison = cannelPoison;

    }



    public void doPoisonTask(MapleMonster monster) {
        /* 213 */
        if (this.cannelPoison)
            /* 214 */ this.doPoisonSchedu = Timer.BuffTimer.getInstance().register(() -> {
            if (monster != null && monster.isAlive() && this.weakChr != null && this.weakChr.get() != null && this.poisonSchedule != 0) {
                this.cannelPoison = false;
                monster.doPoison(this, this.weakChr);
            } else if (this.doPoisonSchedu != null) {
                this.doPoisonSchedu.cancel(true);
                this.doPoisonSchedu = null;
            }
        }, 1000L, 1000L);

    }

}


/* Location:              C:\PGX\Server.jar!\client\status\MonsterStatusEffect.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */